all files / gridList/ gridTile.vue

15.38% Statements 2/13
0% Branches 0/11
0% Functions 0/4
10% Lines 1/10
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83                                                                                                                                                                     
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
//
 
export default {
  name: 'mu-grid-tile',
  props: {
    actionPosition: {
      type: String,
      default: 'right',
      validator (val) {
        return ['left', 'right'].indexOf(val) !== -1
      }
    },
    cols: {
      type: Number,
      default: 1
    },
    rows: {
      type: Number,
      default: 1
    },
    title: {
      type: String
    },
    subTitle: {
      type: String
    },
    titlePosition: {
      type: String,
      default: 'bottom',
      validator (val) {
        return ['top', 'bottom'].indexOf(val) !== -1
      }
    },
    titleBarClass: {
      type: [String, Array, Object]
    }
  },
  computed: {
    tileClass () {
      let classArr = []
      if (this.titlePosition === 'top') classArr.push('top')
      if (this.actionPosition === 'left') classArr.push('action-left')
      if (this.$slots && this.$slots.title && this.$slots.subTitle &&
        this.$slots.title.length > 0 && this.$slots.subTitle.length > 0) {
        classArr.push('multiline')
      }
      return classArr
    },
    style () {
      return {
        width: (this.cols / this.$parent.cols * 100) + '%',
        padding: (this.$parent.padding / 2) + 'px',
        height: (this.$parent.cellHeight * this.rows) + 'px'
      }
    }
  }
}